package com.example;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.MultipartConfigFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.util.unit.DataSize;

import javax.servlet.MultipartConfigElement;

@SpringBootApplication
public class ToolApplication {
    @Configuration
    public class FileUploadConfig {
        @Bean
        public MultipartConfigElement multipartConfigElement() {
            MultipartConfigFactory factory = new MultipartConfigFactory();
            // 单个数据大小
            factory.setMaxFileSize(DataSize.parse("102400KB")); // KB,MB
            // 总上传数据大小
            factory.setMaxRequestSize(DataSize.parse("1024000KB"));
            return factory.createMultipartConfig();
        }
    }

    public static void main(String[] args) {
        SpringApplication.run(ToolApplication.class, args);
//        SpringApplication.run(ToolApplication.class, args);
    }

}
